package cn.shyouchi.wuguanjia.android.ui.statistic;

import android.os.Parcel;
import android.os.Parcelable;

import com.chad.library.adapter.base.entity.MultiItemEntity;

import java.util.List;

/**
 * Created by Eenie on 2017/1/23 at 10:18
 * Email: 472279981@qq.com
 * Des:考勤统计个人工时详情
 */

public class UserMonthRank implements  MultiItemEntity, Parcelable {


    /**
     * id : 5
     * name : 易善涛
     * permissions : 项目主管
     * id_card_head_image : /images/user/20161109/20161109235552YC228276344.jpg
     * work_number : 0
     * service : {"servicesname":"休息日","work_day":31}
     * rank : 0
     */

    private int id;
    private String name;
    private String permissions;
    private String id_card_head_image;
    private int work_number;
    private List<ServiceBean> service;
    private int rank;
    private int refue;


    private int type = StatisticGroupAdapter.STATISTIC_MONTH;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPermissions() {
        return permissions;
    }

    public void setPermissions(String permissions) {
        this.permissions = permissions;
    }

    public String getId_card_head_image() {
        return id_card_head_image;
    }

    public void setId_card_head_image(String id_card_head_image) {
        this.id_card_head_image = id_card_head_image;
    }

    public int getWork_number() {
        return work_number;
    }

    public void setWork_number(int work_number) {
        this.work_number = work_number;
    }

    public List<ServiceBean> getService() {
        return service;
    }

    public void setService(List<ServiceBean> service) {
        this.service = service;
    }

    public int getRank() {
        return rank;
    }

    public void setRank(int rank) {
        this.rank = rank;
    }


    public int getRefue() {
        return refue;
    }

    public void setRefue(int refue) {
        this.refue = refue;
    }

    @Override
    public int getItemType() {
        return type;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public static class ServiceBean implements Parcelable {
        /**
         * servicesname : 休息日
         * work_day : 31
         */

        private String servicesname;
        private int work_day;

        public String getServicesname() {
            return servicesname;
        }

        public void setServicesname(String servicesname) {
            this.servicesname = servicesname;
        }

        public int getWork_day() {
            return work_day;
        }

        public void setWork_day(int work_day) {
            this.work_day = work_day;
        }

        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeString(this.servicesname);
            dest.writeInt(this.work_day);
        }

        public ServiceBean() {
        }

        protected ServiceBean(Parcel in) {
            this.servicesname = in.readString();
            this.work_day = in.readInt();
        }

        public static final Creator<ServiceBean> CREATOR = new Creator<ServiceBean>() {
            @Override
            public ServiceBean createFromParcel(Parcel source) {
                return new ServiceBean(source);
            }

            @Override
            public ServiceBean[] newArray(int size) {
                return new ServiceBean[size];
            }
        };
    }


    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(this.id);
        dest.writeString(this.name);
        dest.writeString(this.permissions);
        dest.writeString(this.id_card_head_image);
        dest.writeInt(this.work_number);
        dest.writeTypedList(this.service);
        dest.writeInt(this.rank);
        dest.writeInt(this.refue);
        dest.writeInt(this.type);
    }

    public UserMonthRank() {
    }

    protected UserMonthRank(Parcel in) {
        this.id = in.readInt();
        this.name = in.readString();
        this.permissions = in.readString();
        this.id_card_head_image = in.readString();
        this.work_number = in.readInt();
        this.service = in.createTypedArrayList(ServiceBean.CREATOR);
        this.rank = in.readInt();
        this.refue = in.readInt();
        this.type = in.readInt();
    }

    public static final Parcelable.Creator<UserMonthRank> CREATOR = new Parcelable.Creator<UserMonthRank>() {
        @Override
        public UserMonthRank createFromParcel(Parcel source) {
            return new UserMonthRank(source);
        }

        @Override
        public UserMonthRank[] newArray(int size) {
            return new UserMonthRank[size];
        }
    };
}
